<?php
session_start();
include_once("../../service/newsletterService.php");

$email = $_POST["email"];
$secCode = isset($_POST["secCode"]) ? strtolower($_POST["secCode"]) : "";

if(isset($email)){
	if($secCode == $_SESSION["securityCode"]){
		if(createNewsletter($email)){
			$_SESSION["emailSubscription"] = $email;
			echo 1;
		} else echo 2;
	} else echo 3;
} else echo 2;
?>